<?php
	$appkey = '23575466';
	$pid = 'mm_115158616_13830833_55676381';
?>
<!DOCTYPE html>
<html>
 <head> 
  <meta charset="utf-8" /> 
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> 
  <script src="http://h5.m.taobao.com/js/src/jquery/jquery-2.1.4.min.js?v=990836632_84344"></script> 
 </head> 
 <body>
 <script src="http://g.alicdn.com/mtb/lib-applink/0.3.2/??callApp.js,linksdk.js?v=3654745502_22304"></script> 
	<script>
		var that = this;
		var appLink = BCSDK_AppLink.init({
			appkey: "<?=$appkey ?>",
			linkKey: "TB",
			openApp: true,
			backURL: "tbopen<?=$appkey ?>://",
			isNeedDownload: true,
			isDefaultRedirect: false,
			timeout: 2000,
			params:{
				pid: "<?=$pid?>"
			}
		});
		console.log("appLink:", appLink);
		<?php if ($type == 'detail'): ?>
		function goDetail() {
			appLink.goDetail({
				linkKey: "TB",
				itemId: "<?=$item_id ?>",
				params: {pid: "<?=$pid?>"}
			})
		}
		<?php else: ?>
		function gotoUrl() {
			appLink.gotoUrl({
				linkKey: "TB",
				url: "<?=$url ?>",
				packageName: "test_packageName",
				params: {
					scm: "test_scm",
					pvid: "test_pvid",
					pid: "<?=$pid?>"
				}
			})
		}; 
		<?php endif; ?>
	</script> 
</body>
</html>